<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Responsive Admin Dashboard Template">
    <meta name="keywords" content="admin,dashboard">
    <meta name="author" content="skcats">
    <!-- The above 6 meta tags *must* come first in the head; any other head content must come *after* these tags -->

    <!-- Title -->
    <title></title>

    <!-- Styles -->
    <link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
    <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="plugins/icomoon/style.css" rel="stylesheet">
    <!--    <link href="plugins/uniform/css/default.css" rel="stylesheet"/>-->
    <!--    <link href="plugins/summernote/summernote.css" rel="stylesheet" type="text/css"/>-->
    <!--    <link href="plugins/switchery/switchery.min.css" rel="stylesheet"/>-->

    <!-- Theme Styles -->
    <link href="css/ecaps.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<!-- Page Container -->
<div class="page-container">
    <!-- Page Content -->
    <div class="page-content page-content-stu-index">
        <!-- Page Header -->
        <div class="page-header">
            <div class="search-form">
                <form action="#" method="GET">
                    <div class="input-group">
                        <input type="text" name="search" class="form-control search-input"
                               placeholder="Type something...">
                        <span class="input-group-btn">
									<button class="btn btn-default" id="close-search" type="button"><i
                                            class="icon-close"></i></button>
								</span>
                    </div>
                </form>
            </div>
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <div class="logo-sm">
                            <a href="javascript:void(0)" id="sidebar-toggle-button"><i class="fa fa-bars"></i></a>
                            <a class="logo-box" href="index.html"><span>ecaps</span></a>
                        </div>
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                                data-target="#bs-example-navbar-collapse-1"
                                aria-expanded="false">
                            <i class="fa fa-angle-down"></i>
                        </button>
                    </div>
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav">
                            <button type="button" class="btn btn-default btn-lg btn-no-border">我的作业</button>
                            <button type="button" class="btn btn-default btn-lg btn-no-border">我的课程</button>
                            <button type="button" class="btn btn-default btn-lg btn-no-border">Large button</button>
                            <button type="button" class="btn btn-default btn-lg btn-no-border">Large button</button>
                        </ul>
                        <ul class="nav navbar-nav navbar-right">
                            <li><a href="javascript:void(0)" id="toggle-fullscreen"><i class="fa fa-expand"></i></a>
                            </li>
                            <li><a href="javascript:void(0)" class="right-sidebar-toggle"
                                   data-sidebar-id="main-right-sidebar"><i class="fa fa-envelope"></i></a></li>
                            <li class="dropdown">
                                <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown"
                                   role="button" aria-haspopup="true"
                                   aria-expanded="false"><i class="fa fa-bell"></i></a>
                                <ul class="dropdown-menu dropdown-lg dropdown-content">
                                    <li class="drop-title">Notifications<a href="#" class="drop-title-link"><i
                                            class="fa fa-angle-right"></i></a></li>
                                    <li class="slimscroll dropdown-notifications">
                                        <ul class="list-unstyled dropdown-oc">
                                            <li>
                                                <a href="#"><span class="notification-badge bg-primary"><i
                                                        class="fa fa-photo"></i></span>
                                                    <span class="notification-info">Finished uploading photos to gallery <b>"South Africa"</b>.
																<small class="notification-date">20:00</small>
															</span></a>
                                            </li>
                                            <li>
                                                <a href="#"><span class="notification-badge bg-danger"><i
                                                        class="fa fa-bolt"></i></span>
                                                    <span class="notification-info">4 new special offers from the apps you follow!
																<small class="notification-date">Yesterday</small>
															</span></a>
                                            </li>
                                            <li>
                                                <a href="#"><span class="notification-badge bg-success"><i
                                                        class="fa fa-bullhorn"></i></span>
                                                    <span class="notification-info">There is a meeting with <b>Ethan</b> in 15 minutes!
																<small class="notification-date">Yesterday</small>
															</span></a>
                                            </li>
                                        </ul>
                                    </li>
                                </ul>
                            </li>
                            <li class="dropdown user-dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                                   aria-haspopup="true" aria-expanded="false">
                                    <span>nihao</span>
                                    <!-- <img -->
                                    <!-- src="http://via.placeholder.com/36x36" alt="" class="img-circle"> -->
                                </a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">Profile</a></li>
                                    <li><a href="#">Calendar</a></li>
                                    <li><a href="#"><span class="badge pull-right badge-danger">42</span>Messages</a>
                                    </li>
                                    <li role="separator" class="divider"></li>
                                    <li><a href="#">Account Settings</a></li>
                                    <li><a href="#">Log Out</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div><!-- /.navbar-collapse -->
                </div><!-- /.container-fluid -->
            </nav>
        </div><!-- /Page Header -->
        <!-- Page Inner -->
        <div class="page-inner">
            <div id="main-wrapper">
                <div class="col-lg-8 center" style="text-align: center;">
                    <div class="panel-body">
                        <div class="form-group">
                            <label for="className" class="col-sm-2 control-label">课程名称</label>
                            <div class="col-sm-10">
                                <select name="c" id="className" class="form-control">
                                    <option value="popup">课1</option>
                                    <option value="inline">课2</option>
                                </select>
                                <br/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="workName" class="col-sm-2 control-label">作业名称</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="workName" placeholder="作业名">
                                <br/>
                            </div>
                        </div>
                        <!-- <div class="form-group"> -->
                        <label class="col-sm-2 control-label">作业内容</label>
                        <div class="col-sm-10" style="text-align: left;">
                            <div class="summernote"></div>
                        </div>
                        <br/>
                        <input type="file" id="upload-file">
                        <div class="progress">
                            <div></div>
                        </div>
                        <button onclick="">上传</button>
                        <!-- </div> -->
                    </div>
                    <br/>
                    <button type="submit" class="btn btn-success">交作业</button>
                </div>
            </div><!-- Main Wrapper -->
            <div class="page-footer">
            </div>
        </div><!-- /Page Inner -->
    </div>
</div><!-- /Page Content -->
</div><!-- /Page Container -->


<!-- Javascripts -->
<script src="js/jquery.min.js"></script>
<script src="plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="js/ecaps.min.js"></script>
</body>
</html>
<style>
    .progress {
        width: 600px;
        height: 10px;
        border: 1px solid #ccc;
        border-radius: 10px;
        margin: 10px 0px;
        overflow: hidden;
    }

    /* 初始状态设置进度条宽度为0px */
    .progress > div {
        width: 0px;
        height: 100%;
        background-color: yellowgreen;
        transition: all .3s ease;
    }
</style>
<script>
    $(function () {
        $('.summernote').summernote({
            height: 350
        });
    })

    function uploadFile() {
        //获取上传的文件
        var uploadFile = $('#upload-file').get(0).file[0];

        var formdata = new FormData();

        formdata.append('fileInfo', uploadFile);
        $.ajax({
            url: '/uploadfileurl',
            type: 'post',
            dataType: 'json',
            processData: false,
            contentType: false,
            xhr: function () {
                var xhr = new XMLHttpRequest();
                //使用XMLHttpRequest.upload监听上传过程，注册progress事件，打印回调函数中的event事件
                xhr.upload.addEventListener('progress', function (e) {
                    console.log(e);
                    //loaded代表上传了多少
                    //total代表总数为多少
                    var progressRate = (e.loaded / e.total) * 100 + '%';

                    //通过设置进度条的宽度达到效果
                    $('.progress > div').css('width', progressRate);
                })

                return xhr;
            }
        })
    }
</script>
